Skip to content

fix(test): stabilize flaky EventsSearchBar has: dropdown test#111903

Merged
JoshuaKGoldberg merged 3 commits intomasterfrom
fix/flaky-events-search-bar-spec
Apr 9, 2026
Merged

fix(test): stabilize flaky EventsSearchBar has: dropdown test#111903
JoshuaKGoldberg merged 3 commits intomasterfrom
fix/flaky-events-search-bar-spec

Conversation

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Mar 31, 2026

The has: dropdown values come from useTags() which reads TagStore. In this unit test, no parent page component calls loadOrganizationTags, but SearchQueryBuilder still fires a GET /organizations/org-slug/tags/ request internally. Without a mock, that request silently fails (mock client swallows it), leaving the dropdown unreliably populated.

  • Mock /organizations/org-slug/tags/ so the has: dropdown is deterministically populated
  • findByRole instead of getByRole for elements that appear asynchronously
  • waitFor at end of each test to let pending state updates settle before unmount

Fixes DAIN-1271

Made with Cursor

@JoshuaKGoldberg JoshuaKGoldberg added Scope: Frontend Automatically applied to PRs that change frontend components Frontend: Rerun Flaky Tests Known flaky tests should be run many times, just to be safe. labels Mar 31, 2026
@JoshuaKGoldberg JoshuaKGoldberg force-pushed the fix/flaky-events-search-bar-spec branch from e347c0d to 047a158 Compare March 31, 2026 17:33
@JoshuaKGoldberg JoshuaKGoldberg changed the title fix(test): Fix flaky EventsSearchBar has: dropdown test fix(test): stabilize flaky EventsSearchBar has: dropdown test Mar 31, 2026
@JoshuaKGoldberg JoshuaKGoldberg force-pushed the fix/flaky-events-search-bar-spec branch 3 times, most recently from 0eac819 to b73441e Compare April 1, 2026 19:30
@JoshuaKGoldberg JoshuaKGoldberg force-pushed the fix/flaky-events-search-bar-spec branch from b73441e to 817a7df Compare April 1, 2026 19:38
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 1, 2026

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review April 1, 2026 19:52
@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team as a code owner April 1, 2026 19:52
@JoshuaKGoldberg JoshuaKGoldberg requested review from a team as code owners April 7, 2026 14:05
@JoshuaKGoldberg JoshuaKGoldberg requested review from a team as code owners April 7, 2026 14:05
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 7, 2026
@github-actions

This comment was marked as outdated.

@sentry

This comment was marked as outdated.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft April 7, 2026 14:09
@JoshuaKGoldberg JoshuaKGoldberg changed the base branch from fix/flaky-test-rerun-infra to master April 7, 2026 14:09
@JoshuaKGoldberg
Copy link
Copy Markdown
Member Author

😩 Cursor changed the PR incorrectly and tagged everyone...

The test timed out at 5000ms on slow CI machines because the
SearchQueryBuilder component's debounce timers (300ms) and complex
rendering combined to push execution time past the threshold.

Add missing mock for /organizations/org-slug/tags/ endpoint, use
jest.useFakeTimers() with userEvent.setup({advanceTimers}) to
eliminate real timer delays, and use findByRole for the edit button
to properly await its appearance after paste.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Made-with: Cursor
@JoshuaKGoldberg JoshuaKGoldberg force-pushed the fix/flaky-events-search-bar-spec branch from f3d83a8 to 02a2b71 Compare April 7, 2026 14:13
@JoshuaKGoldberg JoshuaKGoldberg removed request for a team April 7, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend: Rerun Flaky Tests Known flaky tests should be run many times, just to be safe. Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants